home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / systems / atari / birkhahn-metafont-packed-disks / mf27-2_2e-disk2.zoo / inputs / pandora.lzs / NUMBER.MF < prev    next >
Text File  |  1991-08-15  |  18KB  |  469 lines

  1. %*****************************************************************************
  2. %        Copyright (c) 1989 by N. N. Billawala
  3. %*****************************************************************************
  4.  
  5.  
  6. % number.mf numerals
  7. % 10 characters
  8.  
  9.  
  10. iff OK "0":  "The number 0";  
  11.   beginchar("0",num_width_c#+c_mono#,cap#,0);      
  12.   if mono<>0:save circ; circ1=circ2=circ3=1.05; fi
  13.  
  14.   top z1=(h_stress*w,h+ov_t.uc)//;
  15.   lft z2=(0,(1-v_stress)*h)//;
  16.   bot z3=((1-h_stress)*w,-ov_b.uc)//;
  17.   rt z4=(w,v_stress*h)//;
  18.  
  19.   circular_shape(y1,y3,x2,x4,minor_curve.uc,bowlstem.uc); 
  20.  
  21.  showpoints(1,2,3,4);
  22. adjust(.5num_fit_c#+m_a*c_mfit#,.5num_fit_c#+m_a*c_mfit#); 
  23. show_character; endchar;
  24.  
  25.  
  26. iff OK "1":  "The number 1";  
  27.   beginchar("1",num_width_a#+b_mono#,cap#,0); 
  28.  
  29.   save_num(terminal_thickness)=max(.75thin_stem.uc,.3stem.uc);
  30.   bot z40=(.5w,0);        multpos(1,4,40)(stem.uc,0);      
  31.   lft x4l=round x40l;     bot y4=0;   
  32.   top z1=(x4,h)//; 
  33.   onaline(1l,4l)(2l,3l);  y3l=y3r=cap_bracket_h;           
  34.   onaline(1r,4r)(2r,3r);  y2r=y2l=max(h-cap_bracket_h,y3l); 
  35.   y2l:=min(y2l,h-terminal_thickness-(stem.uc*sind max(25-.5oblique,0)));
  36.  
  37.   p1=fullserif(z4,z1,z3l,z3r,1.25hs,1.25hs)--
  38.      terminalserif.l(z1,z4,z2l,z2r,1.5pt,max(25-.5oblique,0))--cycle;
  39.  
  40.   showpoints(1,2,3,4);
  41. adjust(.5num_fit_a#+m_a*b_mfit#,.5num_fit_a#+m_a*b_mfit#);
  42. show_character; endchar;
  43.  
  44.  
  45.  
  46.  
  47. def character_points=
  48. iff OK "2":  "The number 2"; 
  49.   beginchar(50+alt8,num_width_b#+b_mono#,cap#,0); 
  50.  
  51.   twotension:=10;
  52.   z1=(.05w,.9h)//;
  53.   rt z3r=(w,if inflection_two:.75h else:.7h fi)//;lft z3l=(z3r-(bowlstem.uc,0));
  54.   top y2r=bot y2l+max(1,major_curve.uc)=h+ov_t.uc; 
  55.   good_x_for(2r)(z1,z3r,.5)a; good_x_for(2l)(z1+(bulb_thickness,0),z3l,.5)b;
  56.   top lft z5l=(0,max(1,.9stem.uc))//;   
  57.   z4l=.5[z5l,z3l];                      
  58.   bot lft z6l=(0,0); z6r=z6l+(0,apex.uc)//;  
  59.   bot rt z8=(.95w,0);
  60.   bot y7l=top y7r-max(1,.9stem.uc)=0;
  61.   good_x_for(7l)(z6l,z8,.5)c; good_x_for(7r)(z5r,z8-(tip_thickness,0),.5)d;
  62.  
  63.   ref1=(z6r-(0,max(1,.8thin_stem.uc)))
  64.         ..tension atleast twotension and 1..z3r{upward};
  65.   ref2=z3l{downward}..tension atleast 1 and twotension..z6r; 
  66.   ref3=(-1,y7r)--(w,y7r);
  67.   ref4=z3l{downward}...z4l...z6r{downward}...z6l; 
  68.  
  69.   if inflection_two: 
  70.     rt z5r=ref4 intersectionpoint ref3+(1.3thin_stem.uc,0);  z4r=.5[z5r,z3r]; 
  71.     p1=(bulb.tl(z1,z2l,z2r,cs,bulb_thickness,90)soft i_t 
  72.         ref4 if softpath:)softjoin(z6l fi
  73.        --arm.br(z8,z7r,z7l,.5as,.75tip_thickness,90-arm_angle+.5oblique)soft--
  74.         z5r  if softpath:)softjoin(z5r fi 
  75.        {upward}..z4r...z3r{upward} o_t z2r{left})--cycle;
  76.    else:
  77.      rt z5r=ref1 intersectionpoint ref3; 
  78.      (t1,t2)=ref1 intersectiontimes ref3;
  79.      p1=(bulb.tl(z1,z2l,z2r,cs,bulb_thickness,90)soft i_t 
  80.         ref2 soften(z6r,z6l) 
  81.         arm.br(z8,z7r,z7l,.5as,.75tip_thickness,90-arm_angle+.5oblique)soft--z5r
  82.         if softpath:)softjoin(z5r fi
  83.       --subpath(t1,infinity)of ref1 o_t z2r{left})--cycle;
  84.    fi
  85.   showpoints(1,2,3,4,5,6,7,8);
  86.   adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#); 
  87.   show_character; endchar;
  88.  enddef;
  89.  
  90.  def number_two=save a,b;
  91.   vardef a=condition(inflection_two)t; testing_codes; character_points; enddef; 
  92.   vardef b=condition(inflection_two)f; testing_codes; character_points; enddef;
  93.   if test_all_characters:a;b;else:if inflection_two:a;else:b;fi fi
  94.  enddef;
  95.  
  96.  number_two;  save number_two;
  97.  
  98.  
  99.  
  100.  def three_diagonal_top(expr addtocode)=
  101. iff OK "3":  "The number 3"; 
  102.   beginchar(51+alt6+addtocode,num_width_b#+b_mono#,cap#,0);
  103.  
  104.   top z1=(0w,h)//;
  105.   lft z9=(0,.05h)//;  
  106.   bot lft z10r=(.05w,-ov_b.uc)//; 
  107.   pos10(minor_curve.uc,-90-oblique); 
  108.   z5=if open_tail:(.2w,.57h)//;else:(.3w,.55h)//; fi
  109.   z3r=(round(.97w),h-apex.uc)//;      
  110.   z40=(.97w,h)//;
  111.   x5r=x5+.45thin_stem.uc*(cosd (90-oblique));
  112.   x5l=x5r-.9thin_stem.uc*(cosd (90-oblique));
  113.   top y2r=bot y2l+max(1,.9stem.uc)=h;
  114.   top y6r=top y5r=round(y5+.45thin_stem.uc);
  115.   bot y6l=bot y5l=y5r-max(1,.9thin_stem.uc);
  116.   bot y8r=top y8l-minor_curve.uc=-ov_b.uc;  
  117.   z4l=z5r;
  118.   if open_tail:rt z7r=(w,.65[y8r,y6r])//; 
  119.                lft z7l=(x7r-stem.uc,.65[y8l,y6l]);
  120.           else:rt z7r=(w,v_stress[y8r,y6r])//;
  121.                lft z7l=(x7r-stem.uc,v_stress[y8l,y6l]);    fi
  122.  
  123.   numeric theta[],phi[],d[]; 
  124.     d1=thin_stem.uc;   
  125.     theta1=angle(length(z3r-z5r) +-+ d1,d1);  
  126.     phi1=angle(z3r-z5r)-theta1;
  127.   multpos(3,4)(thin_stem.uc,phi1-90);  
  128.  
  129.   onaline(3l,4l)(41); y41=y2l;
  130.   onaline(3r,4r)(42); y42=y5r;
  131.   good_x_for(2r)(z1,z40,.4)a;  good_x_for(2l)(z1+(bulb_thickness,0),z41,.4)b;
  132.   good_x_for(6r)(z42,z7r,.2)c; good_x_for(6l)(z5l,z7l,.3)d;                
  133.   good_x_for(8r)(z9,z7r,.4)e;  good_x_for(8l)(z9+(bulb_thickness,0),z7l,.4)f;  
  134.  
  135.   p1=(arm.tl(z1,z2l,z2r,.5as,.5tip_thickness,90)soft
  136.       soften(z41,z5r,z5l) z6l{right} i_t z7l{downward} i_t 
  137.       if open_tail:{-(dir (7*h/w))}z10l--z10r{dir(7*h/w)} 
  138.               else:bulb.bl(z9,z8l,z8r,.75cs,.75bulb_thickness,90)      fi
  139.       o_t z7r{upward} o_t z6r{left} soften(z42,z3r,z40) z2r)--cycle;
  140.  
  141.   showpoints(1,2,3,4,5,6,7,8,9,10,40,41,42);
  142.   adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#); 
  143.   show_character; endchar;
  144.  enddef;
  145.  
  146.  def three_round_top(expr addtocode)=
  147. iff OK "3":  "The number 3"; 
  148.   beginchar(51+alt6+addtocode,num_width_b#+b_mono#,cap#,0);
  149.  
  150.   z1=(.05w,.95h)//;  
  151.   lft  z9=(0,.05h)//;
  152.   bot lft z10r=(.05w,-ov_b.uc)//; 
  153.   pos10(minor_curve.uc,-90-oblique); 
  154.   z5=(.3w,.55h)//;  
  155.   x5r=x5+.45thin_stem.uc*(cosd (90-oblique));
  156.   x5l=x5r-.9thin_stem.uc*(cosd (90-oblique));
  157.   top y2r=bot y2l+minor_curve.uc=h+ov_t.uc;
  158.   top y4r=top y5r=round(y5+.45thin_stem.uc);
  159.   bot y4l=bot y5l=y5r-max(1,.9thin_stem.uc);
  160.   y6=.75[y5l,y5r];
  161.   bot y8r=top y8l-major_curve.uc=-ov_b.uc;  
  162.   rt z3r=(round(.97w),v_stress[y6,y2r])//;
  163.   lft z3l=(x3r-stem.uc,v_stress[y5r,y2l]);
  164.   if open_tail:rt z7r=(w,.65[y8r,y6])//; 
  165.                     lft z7l=(x7r-stem.uc,.65[y8l,y4l]);
  166.                else:rt z7r=(w,v_stress[y8r,y6])//;
  167.                     lft z7l=(x7r-stem.uc,v_stress[y8l,y4l]);    fi
  168.   z3=.5[z3l,z3r];     
  169.  
  170.   good_x_for(2r)(z1,z3r,.5)a;  good_x_for(2l)(z1+(bulb_thickness,0),z3l,.5)b;
  171.   good_x_for(4r)(z5r,z3l,.4)c; good_x_for(4l)(z5l,z7l,.4)d;                
  172.   good_x_for(6)(z5,z3,.6)e;                                  
  173.   good_x_for(8r)(z9,z7r,.4)g;  good_x_for(8l)(z9+(bulb_thickness,0),z7l,.4)f;  
  174.  
  175.   p1=(bulb.tl(z1,z2l,z2r,1.2cs,.75bulb_thickness,90)soft i_t
  176.       z3l{downward} i_t z4r{left} soften(z5r,z5l) z4l{right} i_t z7l{downward}
  177.       i_t  if open_tail:{-(dir (7*h/w))}z10l--z10r{dir(7*h/w)} 
  178.        else:bulb.bl(z9,z8l,z8r,.75cs,.75bulb_thickness,90)      fi
  179.       o_t z7r{upward} o_t 
  180.       z6{left}--(z6+(0,epsilon){right} o_t z3r{upward} o_t z2r{left}))--cycle;
  181.  
  182.   showpoints(1,2,3,4,5,6,7,8,9);
  183.   adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#); 
  184.   show_character; endchar;
  185.  enddef;    
  186.  
  187.  
  188.  vardef number_three=save first,second,third,fourth,addtocode;
  189.   addtocode:=-1;
  190.   vardef first=condition(diagonal_three)t; condition(open_tail)t; 
  191.            testing_codes; three_diagonal_top(0); enddef;
  192.   vardef second=condition(diagonal_three)t; condition(open_tail)f; 
  193.            testing_codes; three_diagonal_top(incr addtocode); enddef;
  194.   vardef third=condition(diagonal_three)f; condition(open_tail)t; 
  195.            testing_codes; three_round_top(incr addtocode+alt7); enddef;
  196.   vardef fourth=condition(diagonal_three)f; condition(open_tail)f; 
  197.            testing_codes; three_round_top(incr addtocode); enddef;
  198.  
  199.   if test_all_characters:first;second;third;fourth;
  200.    elseif diagonal_three and open_tail:first;
  201.    elseif diagonal_three and (not open_tail):second;  
  202.    elseif (not diagonal_three) and open_tail:third;
  203.    elseif (not diagonal_three) and (not open_tail):fourth;    fi
  204.  enddef;
  205.  
  206.  number_three;  save number_three,three_diagonal_top,three_round_top;
  207.  
  208.  
  209.  
  210. iff OK "4":  "The number 4"; 
  211.   beginchar(52+alt10,num_width_e#+.5*(d_mono#+e_mono#),cap#,0);
  212.  
  213.   min_limit(join_radius)(.5minor_curve.uc); 
  214.   top rt z11r=(round(.82w),h)//;     multpos(11,13)(max(1,stem.uc),0);
  215.   rt z13r=(round(.82w),0);      
  216.   bot lft z4l=(0,round(.2h))//;      pos4(apex.uc,90-apex_angle);
  217.   onaline(11r,13r)(10r,12r,23,25);   
  218.   onaline(11l,13l)(12l,20,22,24,26,27); 
  219.   y12l=y12r=min(cap_bracket_h,y4l); y20=y11r-max(thin_stem.uc,.3stem.uc,1);
  220.   y10=if open_four:.75h else:h fi;  y27=y10+thin_stem.uc-stem.uc;
  221.   y24=y25=y4l; top y23=bot y24+max(1,.9thin_stem.uc); 
  222.   pos10(apex.uc,0-oblique);
  223.   z3l=z4r; 
  224.   z1r=if open_four:(x13l,h-.5thin_stem.uc)// else:z20 fi; %z1r controls top of 4
  225.   multpos(1,2,3)(thin_stem.uc,constant_angle(z1r,z3l,thin_stem.uc));
  226.   onaline(1r,3r)(2r,21);            y21=y22=y23; y2r=notch_pos[y20,y21]; 
  227.   onaline(2l,3l)(28);               y28=y11r; y26=.8[y22,y20];
  228.   rt z5=(w,y4l)//;                   
  229.   ref1=z26--z20--z2r;
  230.  
  231.   if open_four:
  232.      p1=(z27--fullserif(z13,z11,z12l,z12r,.75hs,.75hs) 
  233.          soften (z10r,z10) z27)--cycle;
  234.      p2=(arm.br(z5,z23,z25,.15as,.25tip_thickness,90-arm_angle+.5oblique)
  235.          soften(z21,z1r,z1l,z4r,z4l) z25)--cycle;
  236.     else:
  237.      p1=(z2l soften(z4r,z4l,z24) fullserif(z13,z11,z12l,z12r,.75hs,.75hs)--z25
  238.           if softpath:)softjoin(z25 fi
  239.         --arm.br(z5,z23,z25,.15as,.25tip_thickness,90-arm_angle+.5oblique)
  240.         soften(z23,z11r,z28) z2l)--cycle;
  241.      p1'=(upnotch(ref1,angle(z20-z22),notch_length.uc) soften(z21,z22) z26)
  242.          --cycle;
  243.     fi
  244.   showpoints(1,2,3,4,5,10,11,12,13,20,21,22,23,24,25,26,27,28);
  245. adjust(.5num_fit_e#+m_f*.5(d_mfit#+e_mfit#),
  246.        .5num_fit_e#+m_ff*.5(d_mfit#+e_mfit#)); 
  247. show_character; endchar;
  248.  
  249.  
  250.  
  251.  def character_points=
  252. iff OK "5":  "The number 5"; 
  253.   beginchar(53+alt6,num_width_b#+b_mono#,cap#,0);
  254.  
  255.   top z1=(.9w,h)//;
  256.   top z3l=(round .05w,h)//;  multpos(3,5)(thin_stem.uc,0-oblique);
  257.   z5l=(round .05w,if open_tail:.6h else:.55h fi)//; 
  258.   lft z9=(0,.05h)//;  
  259.   bot lft z10r=(.05w,-ov_b.uc)//; 
  260.   pos10(minor_curve.uc,-90-oblique);
  261.  
  262.   top y2r=bot y2l+max(1,.9stem.uc)=h;
  263.   bot y4l=top y4r-max(1,.9thin_stem.uc)=bot y5l;
  264.   bot y8r=top y8l-minor_curve.uc=-ov_b.uc;  
  265.   if open_tail:rt z7r=(w,.65[y8r,y4r])//;lft z7l=(x7r-stem.uc,.65[y8l,y4l]);
  266.    else:rt z7r=(w,v_stress[y8r,y4r])//;
  267.         lft z7l=(x7r-stem.uc,v_stress[y8l,y4l]);     fi
  268.   onaline(3r,5r)(40,41); y40=y2l; y41=y4r;
  269.  
  270.   good_x_for(2r)(z3l,z1,.5)a;   good_x_for(2l)(z40,z1-(tip_thickness,0),.5)b;
  271.   good_x_for(4r)(z41,z7r,.4)c;  good_x_for(4l)(z5l,z7l,.55)d;                
  272.   good_x_for(8r)(z9,z7r,.4)e;   good_x_for(8l)(z9+(bulb_thickness,0),z7l,.4)f;  
  273.  
  274.   if open_tail:
  275.      p1=(arm.tr(z1,z2l,z2r,.5as,.5tip_thickness,90)soft soften(z3l,z5l)
  276.         z4l{right} i_t z7l{downward} i_t 
  277.         {-(dir (7*h/w))}z10l--z10r{dir(7*h/w)} o_t
  278.         z7r{upward} o_t z4r{left} soften(z41,z40) z2l)--cycle;
  279.    else:
  280.      p1=(arm.tr(z1,z2l,z2r,.5as,.5tip_thickness,90)soft soften(z3l,z5l)
  281.         z4l{right} i_t z7l{downward} i_t z8l{left} i_t
  282.         bulb.bl(z9,z8l,z8r,.75cs,.75bulb_thickness,90) 
  283.         o_t z7r{upward} o_t z4r{left} soften(z41,z40) z2l)--cycle;
  284.    fi
  285.   showpoints(1,2,3,4,5,7,8,9,10,40,41);
  286.   adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#); 
  287.   show_character; endchar;
  288.  enddef;
  289.  
  290.  vardef number_five= save a,b;
  291.   vardef a=condition(open_tail)t; testing_codes; character_points; enddef;
  292.   vardef b=condition(open_tail)f; testing_codes; character_points; enddef; 
  293.   if test_all_characters:a;b; else:if open_tail:a; else:b; fi fi
  294.  enddef;
  295.  
  296.  number_five;  save number_five;
  297.  
  298.  
  299.  
  300.  def character_points=
  301. iff OK "6":  "The number 6"; 
  302.   beginchar(54+alt6,num_width_c#+c_mono#,cap#,0);   
  303.  
  304.   save_pairs(good_dir);
  305.   top z0r=(.9w,h+ov_t.uc)//;  pos0(max(1,.9minor_curve.uc),90+taper_angle);   
  306.   z1=(.85w,.98h)//;
  307.   lft z3r=(0,(1-v_stress)*h)//;  rt z3l=z3r+(stem.uc,0);  
  308.   top y2r=bot y2l+minor_curve.uc=h+ov_t.uc; 
  309.   good_x_for(2l)(z3l,z1-(bulb_thickness,0),.7)a; good_x_for(2r)(z3r,z1,.7)b;
  310.   bot y4r=top y4l-minor_curve.uc=-ov_b.uc;
  311.   y6r=y6l+max(1,round(.9minor_curve.uc))=.7h;   
  312.   rt z5r=(w,v_stress[y4r,y6r])//;
  313.   lft z5l=(x5r-stem.uc,v_stress[y4r,y6r]);
  314.   good_x_for(4l)(z3l,z5l,.5)c; good_x_for(4r)(z3r,z5r,.5)d;
  315.   y100=(.5ductal)[y6l,y3l]; 
  316.  
  317.   ref1=z4l{left} i_t z3l{upward} i_t if open_tail:z0l else: z2l{right} fi;
  318.   z7l=ref1 intersectionpoint ((0,y5r)..(w,y5r)//);
  319.   z7r=ref1 intersectionpoint ((0,y100)..(w,y100)//);
  320.   (t1,t2)=ref1 intersectiontimes ((0,y100)..(w,y100)//);
  321.   good_x_for(6l)(z7l,z5l,.52)e; good_x_for(6r)(z7r,z5r,.5)f;
  322.  
  323.   ref2=z6r{left}...z7r; 
  324.     if (angle(direction 1 of ref2)<=-90-oblique)and 
  325.        (angle(direction 1 of ref2)>=-180-oblique):good_dir7=(0,0);
  326.       else: good_dir7=dir(-90-oblique);fi
  327.  
  328.   p1'=z6l{left} i_t z7l{downward} i_t z4l{right} i_t z5l{upward} i_t cycle;
  329.   p1=if open_tail:(z7r+(0,eps){upward} i_t z0l--z0r 
  330.              else:(subpath(t1,infinity) of ref1--
  331.                    bulb.tr(z1,z2l,z2r,.75cs,.75bulb_thickness,90)soft    fi
  332.      o_t z3r{downward} o_t 
  333.      z4r{right} o_t z5r{upward} o_t z6r{left}...z7r{good_dir7})--cycle;
  334.  
  335.   showpoints(0,1,2,3,4,5,6,7);
  336.   adjust(.5num_fit_c#+m_a*c_mfit#,.5num_fit_c#+m_a*c_mfit#); 
  337.   show_character; endchar;
  338.  enddef;
  339.  
  340.  def number_six=save a,b;
  341.   vardef a=condition(open_tail)t; testing_codes; character_points; enddef; 
  342.   vardef b=condition(open_tail)f; testing_codes; character_points; enddef;
  343.   if test_all_characters:a;b;else:if open_tail:a;else:b;fi fi
  344.  enddef;
  345.  
  346.  number_six;  save number_six;
  347.  
  348.  
  349.  
  350. iff OK "7":  "The number 7"; 
  351.   beginchar("7",num_width_b#+b_mono#,cap#,0);
  352.  
  353.   top z1=(0,h)//;
  354.   z3r=(w,h-apex.uc)//;      
  355.   z40=(w,h)//;
  356.   z5l=(.05w,0);
  357.   z6=(x5l+bowlstem.uc,0);
  358.   top y2r=bot y2l+max(1,.9stem.uc)=h;
  359.  
  360.   numeric theta[],phi[],d[]; 
  361.     d1=thin_stem.uc;   
  362.     theta1=angle(length(z3r-z5l) +-+ d1,d1);  
  363.     phi1=angle(z3r-z5l)-theta1;
  364.   multpos(3,5)(thin_stem.uc,phi1-90);  
  365.   
  366.   onaline(3l,5l)(4l,41);  y41=y2l; y4l=.5[y5l,y41];
  367.   z4r=.5[z3r,z5r];
  368.   good_x_for(2r)(z1,z40,.5)a;  good_x_for(2l)(z1+(tip_thickness,0),z41,.5)b;
  369.  
  370.   p1=(arm.tl(z1,z2l,z2r,.5as,.75tip_thickness,90-arm_angle+oblique)soft--z41
  371.        if softpath:)softjoin( else:--fi 
  372.      flex(z41,(z4l-(.05w,0)),z5l))softjoin(z5l--z6)softjoin
  373.      (flex(z6,(z4r-(.05w,0)),z3r))
  374.        if softpath:softjoin(z3r--z40)softjoin else:--fi (z40--z2r)--cycle;  
  375.  
  376.   showpoints(1,2,3,4,5,6,40,41);
  377. adjust(.7num_fit_b#+m_e*b_mfit#,.3num_fit_b#+m_ee*b_mfit#); 
  378. show_character; endchar;
  379.  
  380.  
  381. iff OK "8":  "The number 8";
  382.   beginchar("8",num_width_c#+d_mono#,cap#,0);
  383.  
  384.   bot z6r=(.5w,-ov_b.uc);      top y6l=bot y6r+thin_stem.lc;
  385.   top z2l=(x6r,h+ov_t.uc)//;   bot y2r=top y2l-thin_stem.lc;
  386.   z4=z8=.55[z6r,z2l];                 
  387.   rt z1l=(round(.95w),.5[y4,y2l])//; lft z1r=rt z1l-(thin_stem.lc,0);
  388.   lft z3l=(round(.05w),.5[y4,y2l])//; rt z3r=lft z3l+(stem.lc,0);  
  389.   z1=.5[z1l,z1r]; z3=.5[z3l,z3r];
  390.   rt z5r=(w,.5[y6r,y4])//;     lft z5l=rt z5r-(stem.lc,0);      z5=.5[z5l,z5r];
  391.   lft z7r=(0,.5[y6r,y4])//;    rt z7l=lft z7r+(thin_stem.lc,0); z7=.5[z7l,z7r];
  392.   good_x_for(2r)(z3r,z1r,.5)a;  
  393.   good_x_for(6l)(z7l,z5l,.5)b;
  394.  
  395.   ref5=z3..z4..z5; ref6=z1..z8..z7; 
  396.   pos4(max(1,.95stem.lc),
  397.       (angle(postcontrol 1 of ref5-precontrol 1 of ref5))+90);
  398.   pos8(max(1,thin_stem.lc),
  399.       (angle(postcontrol 1 of ref6-precontrol 1 of ref6))+90);
  400.  
  401.   ref1=z2r{left}  i_t z3r{downward} i_t z4r o_t z5r{downward} o_t z6r{left};
  402.   ref2=z6r{left}  o_t z7r{upward}   o_t z8l i_t z1r{upward}   i_t z2r{left};
  403.   ref3=z2l{right} o_t z1l{downward} o_t z8r i_t z7l{downward} i_t z6l{right};
  404.   ref4=z6l{right} i_t z5l{upward}   i_t z4l o_t z3l{upward}   o_t z2l{right};
  405.   (t1,t2)=ref1 intersectiontimes ref2; (t3,t4)=ref1 intersectiontimes ref3;
  406.   (t5,t6)=ref3 intersectiontimes ref4; (t7,t8)=ref2 intersectiontimes ref4;
  407.  
  408.   p1 =(subpath(0,t4-eps)of ref3)--(subpath(t3+eps,infinity)of ref1)--
  409.       (subpath(0,t7-eps)of ref2)--(subpath(t8+eps,infinity)of ref4)--cycle;
  410.   p1'=(subpath(0,t1-eps)of ref1)--(subpath(t2+eps,infinity)of ref2)--cycle;
  411.   p2'=(subpath(0,t6-eps)of ref4)--(subpath(t5+eps,infinity)of ref3)--cycle;
  412.  
  413.   showpoints(1,2,3,5,6,7,41,42,43,44);
  414. adjust(.5num_fit_c#+m_a*d_mfit#,.5num_fit_c#+m_a*d_mfit#); 
  415. show_character; endchar;
  416.  
  417.  
  418.  
  419.  def character_points=.
  420. iff OK "9":  "The number 9"; 
  421.   beginchar(57+alt6,num_width_c#+c_mono#,cap#,0);
  422.  
  423.   save_pairs(good_dir);
  424.   bot z0r=(.1w,-ov_b.uc)//; pos0(max(1,.9minor_curve.uc),-90+taper_angle); 
  425.   z1=(.15w,.02h)//;
  426.   rt z3r=(w,v_stress*h)//;  lft z3l=z3r-(stem.uc,0);
  427.   bot y2r=top y2l-minor_curve.uc=-ov_b.uc;
  428.   good_x_for(2l)(z3l,z1+(bulb_thickness,0),.7)a; good_x_for(2r)(z3r,z1,.7)b;
  429.   top y4r=bot y4l+minor_curve.uc=h+ov_t.uc; 
  430.   y6r=y6l-max(1,round(.9minor_curve.uc))=.3h;   
  431.   lft z5r=(0,(1-v_stress)[y4r,y6r])//;
  432.   rt z5l=(x5r+stem.uc,(1-v_stress)[y4r,y6r]);
  433.   good_x_for(4l)(z3l,z5l,.5)c; good_x_for(4r)(z3r,z5r,.5)d;
  434.   y100=(.5ductal)[y6l,y3l]; 
  435.  
  436.   ref1=z4l{right} i_t z3l{downward} i_t if open_tail:z0l else:z2l{left} fi;
  437.   z7l=ref1 intersectionpoint ((0,y5r)..(w,y5r)//);
  438.   z7r=ref1 intersectionpoint ((0,y100)..(w,y100)//);
  439.   (t1,t2)=ref1 intersectiontimes ((0,y100)..(w,y100)//);
  440.   good_x_for(6l)(z7l,z5l,.52)e; good_x_for(6r)(z7r,z5r,.5)f;
  441.  
  442.   ref2=z6r{right}...z7r; 
  443.     if (angle(direction 1 of ref2)<=90-oblique)and 
  444.        (angle(direction 1 of ref2)>=-oblique):good_dir7=(0,0);
  445.       else: good_dir7=dir(90-oblique);fi
  446.  
  447.   p1'=z6l{right} i_t z7l{upward} i_t z4l{left} i_t z5l{downward} i_t cycle;
  448.   p1 =if open_tail:(z7r-(0,eps){downward} i_t z0l--z0r
  449.               else:(subpath(t1,infinity) of ref1--
  450.                     bulb.bl(z1,z2l,z2r,.75cs,.75bulb_thickness,90)soft     fi
  451.       o_t z3r{upward} o_t 
  452.       z4r{left} o_t z5r{downward} o_t z6r{right}...z7r{good_dir7})--cycle;
  453.  
  454.   showpoints(0,1,2,3,4,5,6,7);
  455.   adjust(.5num_fit_c#+m_a*c_mfit#,.5num_fit_c#+m_a*c_mfit#); 
  456.   show_character; endchar;
  457.  enddef;
  458.  
  459.  def number_nine=save a,b;
  460.   vardef a=condition(open_tail)t; testing_codes; character_points; enddef; 
  461.   vardef b=condition(open_tail)f; testing_codes; character_points; enddef;
  462.   if test_all_characters:a;b;else:if open_tail:a;else:b;fi fi
  463.  enddef;
  464.  
  465.  number_nine;  save number_nine;
  466.  
  467.  
  468.  
  469.